package com.hdax.dmw.scheduler.mappers;

import com.hdax.dmw.entity.scheduler.DmSchedulerSeat;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author guoyisha
* @description 针对表【dm_scheduler_seat(排期座位表)】的数据库操作Mapper
* @createDate 2023-06-15 12:16:43
* @Entity com.hdax.dmw.entity.scheduler.DmSchedulerSeat
*/
public interface DmSchedulerSeatMapper extends BaseMapper<DmSchedulerSeat> {

    @Select({
            "select * from dm_scheduler_seat",
            "where",
            " scheduleId=#{scheduleId}",
            " and orderNo is null",
            " and userId is null",
            " and status = 1"
    })
    List<DmSchedulerSeat> getSeatInfos(@Param("scheduleId") Long scheduleId);

    @Select({
            "select seat.*,price.price from dm_scheduler_seat seat, dm_scheduler_seat_price price",
            " where seat.scheduleId = price.scheduleId",
            " and seat.scheduleId=#{scheduleId}",
            "and seat.areaLevel = price.areaLevel",
            " and seat.x=#{x}",
            " and seat.y=#{y}"
    })
    DmSchedulerSeat detail(@Param("scheduleId")Long scheduleId,
                           @Param("x")Integer x,
                           @Param("y")Integer y);

}




